#ifndef WRAP_DIRENT_H
#define WRAP_DIRENT_H

struct dirent;

namespace Wrap {

/// @see https://man7.org/linux/man-pages/man3/scandir.3.html
/// @brief should manually free(namelist[i]) and free(namelist)
/// @return The scandir() function returns the number of directory entries
/// selected. On error, -1 is returned, with errno set to indicate the error.
/// @throw ENOENT The path in @c dir does not exist.
/// @throw ENOMEM Insufficient memory to complete the operation.
/// @throw ENOTDIR The path in @c dir is not a directory.
int scandir_alphasort_(
    const char *dir, struct dirent ***namelist,
    int (*selector)(const struct dirent *)
);

/// @see https://man7.org/linux/man-pages/man0/dirent.h.0p.html
const char *d_name_(const struct dirent *namelist);

}

#endif